package com.huawei.appgallery.wishlist.ui.activity;

import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build.VERSION;
import android.os.Bundle;
import com.huawei.appgallery.foundation.ui.framework.activity.BaseActivity;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.appgallery.foundation.ui.framework.uikit.ContractFragment;
import o.azb;
import o.cep;
import o.cgv;
import o.cjk;
import o.cjm;
import o.dce.a;
import o.dce.e;
import o.dce.i;
import o.dch;
import o.ContentManager;

public class WishListDeleteActivity extends BaseActivity {
    private static int ˊॱ = -1;
    private static String ˋॱ = "WishListDeleteActivity";
    private TaskFragment ͺ;

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        cgv.ˋ(this, a.ˋ, ॱˊ() ? a.ˋ : a.ˎ);
        getWindow().getDecorView().setBackgroundColor(getResources().getColor(a.ˎ));
        if (getActionBar() != null) {
            getActionBar().hide();
        }
        setContentView(i.ˋ);
        azb.ˏ(findViewById(e.ͺॱ));
        ͺ();
    }

    private void ͺ() {
        ContractFragment contractFragment = (ContractFragment) cjk.ˎ().ˊ(new cjm("wish.delete.list.fragment", null));
        if (contractFragment instanceof TaskFragment) {
            this.ͺ = (TaskFragment) contractFragment;
            this.ͺ.ˋ(ˏॱ(), e.ᐝˋ, "WishListDeleteActivity");
        }
    }

    public static boolean ᐝ() {
        return cep.ˏ();
    }

    public static boolean ॱˊ() {
        if (VERSION.SDK_INT < 26) {
            return ᐝ();
        }
        if (ˊॱ == -1) {
            int i;
            if (ᐝॱ()) {
                i = 1;
            } else {
                i = 0;
            }
            ˊॱ = i;
        }
        if (ˊॱ != 1) {
            return false;
        }
        return true;
    }

    private static boolean ᐝॱ() {
        PackageManager packageManager = ContentManager.getInstant().getContext().getPackageManager();
        try {
            if ("com.android.packageinstaller".equals(packageManager.getPermissionInfo("com.android.packageinstaller.permission.REQUEST_DELETE_PACKAGES", 0).packageName) && packageManager.checkPermission("com.android.packageinstaller.permission.REQUEST_DELETE_PACKAGES", ContentManager.getInstant().getContext().getPackageName()) == 0) {
                return true;
            }
            return false;
        } catch (NameNotFoundException e) {
            dch.ˎ.ˊ(ˋॱ, "can not find DELETE_PACKAGES_PERMISSION");
            return false;
        }
    }
}
